//
//  SLPOPBasicController.m
//  Objective-C
//
//  Created by 陆承东 on 2018/7/7.
//  Copyright © 2018年 S_Line. All rights reserved.
//

#import "SLPOPBasicController.h"

#import <pop/POP.h>

@interface SLPOPBasicController ()



@end

@implementation SLPOPBasicController

- (void)initNavBar {
    self.navTitle = @"POP BasicAnimation";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavBar];
    
    [self initView];
}

- (void)initView {
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    CGFloat red = (CGFloat)arc4random() / (CGFloat)UINT_MAX;
    CGFloat green = (CGFloat)arc4random() / (CGFloat)UINT_MAX;
    CGFloat blue = (CGFloat)arc4random() / (CGFloat)UINT_MAX;
    UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
    
    POPBasicAnimation *basic = [POPBasicAnimation animationWithPropertyNamed:kPOPViewBackgroundColor];
    basic.fromValue = self.view.backgroundColor;
    basic.toValue = color;
    basic.duration = 1.0;
    basic.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    [self.view pop_addAnimation:basic forKey:@"basic"];
}

@end
